Various optical test apparatus are known in which a workpiece is placed between a light source and a light sensitive sensor. Usually, a diaphragm is interposed between the light source and the workpiece. This diaphragm customarily has the shape of the workpiece so that the beam of light irradiating the workpiece fits the outlined shape of a correct workpiece. If the workpiece fits this shape, then the sensor receives practically no light, since it will be entirely within the shadow of the workpiece. This identifies the workpiece, or its position, and discontinuities which permit the passage of light will also cause excess light to be received by the receiver. If the contour of the workpiece does not fit the outline of the beam of light, as masked by the diaphragm, then a defective or improper workpiece has been identified. Such arrangements have the disadvantage that each specific type of workpiece requires a special mask or diaphragm which must be exchanged for placement in the beam path if different workpieces are to be tested. Additionally, the alignment of the workpiece with respect to the mask must be highly accurate, in two axial directions, in order to prevent erroneous output indications. These, otherwise simple, testing arrangements also cannot readily decode or indicate small changes from a standard workpiece, for example a chamfer at one side of a corner.